home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / adrephon.sit / AddrePhone 1.0 / background_2815.txt < prev    next >
Text File  |  1991-02-05  |  14KB  |  632 lines

  1. -- background: 2815 from stack: in.0
  2. -- bmap block id: 3214
  3. -- flags: 4000
  4. -- background id: 0
  5. -- name: Data
  6. ----- HyperTalk script -----
  7. on idle
  8.   global checkMark
  9.   if the icon of bg btn id 31 is 23736 then exit idle
  10.   if optionKey() is down then
  11.     set icon of bg btn id 6 to 518
  12.     set icon of bg btn id 5 to 9904
  13.     if bg field id 7 is not empty then
  14.       set style of bg btn id 21 to rectangle
  15.       set showName of bg btn id 21 to true
  16.     end if
  17.     put true into checkMark
  18.   else if checkMark is true then
  19.     set icon of bg btn id 6 to 9902
  20.     set icon of bg btn id 5 to 1943
  21.     set showName of bg btn id 21 to false
  22.     set style of bg btn id 21 to transparent
  23.     put false into checkMark
  24.   end if
  25. end idle
  26.  
  27. on openCard
  28.   if bg field id 7 is not empty then
  29.     set hilite of bg btn id 21 to true
  30.   else
  31.     set hilite of bg btn id 21 to false
  32.   end if
  33. end openCard
  34.  
  35. on closeField
  36.   put the date into line 1 of field ID 3
  37. end closeField
  38.  
  39. on newCard
  40.   put the date into line 2 of field id 3
  41.   click at loc of field id 18
  42. end newCard
  43.  
  44. function check
  45. put bg field id 24 into hi
  46. if not ((length of hi) is 8 and (char 3 of hi) = "/" and (char 6 of hi) = "/") then
  47.   goof
  48.   return true
  49. end if
  50. put value(char 1 to 2 of hi) into mon
  51. put value(char 4 to 5 of hi) into day
  52. if day <1 or day >31 or mon <1 or mon >12 then
  53.   goof
  54.   return true
  55. end if
  56. return false
  57. end check
  58.  
  59. on goof
  60.   if random(2) = 1 then
  61.     play "goofed up"
  62.   else
  63.     play "does not compute"
  64.   end if
  65. end goof
  66.  
  67.  
  68.  
  69. -- part 18 (field)
  70. -- low flags: 03
  71. -- high flags: 0000
  72. -- rect: left=15 top=31 right=57 bottom=322
  73. -- title width / last selected line: 0
  74. -- icon id / first selected line: 0 / 0
  75. -- text alignment: 0
  76. -- font id: 2
  77. -- text size: 18
  78. -- style flags: 0
  79. -- line height: 24
  80. -- part name: Name*
  81.  
  82.  
  83. -- part 2 (field)
  84. -- low flags: 03
  85. -- high flags: 0000
  86. -- rect: left=36 top=168 right=223 bottom=340
  87. -- title width / last selected line: 0
  88. -- icon id / first selected line: 0 / 0
  89. -- text alignment: 0
  90. -- font id: 2
  91. -- text size: 14
  92. -- style flags: 0
  93. -- line height: 18
  94. -- part name: Phone Number*
  95. ----- HyperTalk script -----
  96. on closeField
  97.   repeat with lineNumber = 1 to 3
  98.     put word 1 of line lineNumber of me into temp
  99.     if temp = empty then next repeat
  100.     if (length of word 1 of line lineNumber of me) = 7 then
  101.       put "(206)" & (char 1 to 3 of temp) & "-" & (char 4 to 7 of temp) into more
  102.       put more into word 1 of line lineNumber of me
  103.     end if
  104.     if (length of word 1 of line lineNumber of me) = 10 then
  105.       put "(" & (char 1 to 3 of temp) & ")" & (char 4 to 6 of temp) & "-" & (char 7 to 10 of temp) into more
  106.       put more into word 1 of line lineNumber of me
  107.     end if
  108.     if (length of word 1 of line lineNumber of me) Γëá 13 then
  109.       goof
  110.       select line lineNumber of me
  111.       exit closeField
  112.     end if
  113.   end repeat
  114.   pass closeField
  115. end closeField
  116.  
  117.  
  118.  
  119. -- part 1 (field)
  120. -- low flags: 03
  121. -- high flags: 0000
  122. -- rect: left=15 top=55 right=164 bottom=339
  123. -- title width / last selected line: 0
  124. -- icon id / first selected line: 0 / 0
  125. -- text alignment: 0
  126. -- font id: 3
  127. -- text size: 12
  128. -- style flags: 0
  129. -- line height: 16
  130. -- part name: Address*
  131.  
  132.  
  133. -- part 5 (button)
  134. -- low flags: 00
  135. -- high flags: 2000
  136. -- rect: left=169 top=226 right=252 bottom=197
  137. -- title width / last selected line: 0
  138. -- icon id / first selected line: 1943 / 1943
  139. -- text alignment: 1
  140. -- font id: 0
  141. -- text size: 12
  142. -- style flags: 0
  143. -- line height: 16
  144. -- part name: Prev
  145. ----- HyperTalk script -----
  146. on mouseUp
  147.   if the optionKey is down then
  148.     goNote
  149.   else
  150.     go to prev card
  151.   end if
  152. end mouseUp
  153.  
  154. on goNote
  155.   repeat until mouseClick()
  156.     go to prev card
  157.     if bg field id 7 is not empty then exit repeat
  158.   end repeat
  159. end goNote
  160.  
  161.  
  162.  
  163. -- part 6 (button)
  164. -- low flags: 00
  165. -- high flags: 2000
  166. -- rect: left=218 top=226 right=252 bottom=244
  167. -- title width / last selected line: 0
  168. -- icon id / first selected line: 9902 / 9902
  169. -- text alignment: 1
  170. -- font id: 0
  171. -- text size: 12
  172. -- style flags: 0
  173. -- line height: 16
  174. -- part name: Next
  175. ----- HyperTalk script -----
  176. on mouseUp
  177.   if the optionKey is down then
  178.     goNote
  179.   else
  180.     go to next card
  181.   end if
  182. end mouseUp
  183.  
  184. on goNote
  185.   repeat until mouseClick()
  186.     go to next card
  187.     if bg field id 7 is not empty then exit repeat
  188.   end repeat
  189. end goNote
  190.  
  191.  
  192.  
  193. -- part 11 (field)
  194. -- low flags: 03
  195. -- high flags: 0000
  196. -- rect: left=72 top=290 right=307 bottom=143
  197. -- title width / last selected line: 0
  198. -- icon id / first selected line: 0 / 0
  199. -- text alignment: 0
  200. -- font id: 0
  201. -- text size: 12
  202. -- style flags: 0
  203. -- line height: 16
  204. -- part name: Age
  205. ----- HyperTalk script -----
  206. on mouseUp
  207.   put field ID 24 into bday
  208.   if bday is empty then
  209.     put empty into me
  210.     exit mouseUp
  211.   end if
  212.   if check() then exit mouseUp
  213.   put the date into today
  214.   convert bday to dateItems
  215.   convert today to dateItems
  216.   put (item 1 of today - item 1 of bday) into age
  217.   if item 2 of bday > item 2 of today then subtract 1 from age
  218.   if item 2 of bday = item 2 of today and item 3 of bday > item 3 of today then subtract 1 from age
  219.   if age < 0 then
  220.     goof
  221.     put empty into field ID 11
  222.     exit mouseUp
  223.   end if
  224.   put age into field ID 11
  225. end mouseUp
  226.  
  227.  
  228.  
  229.  
  230. -- part 3 (field)
  231. -- low flags: 01
  232. -- high flags: 0000
  233. -- rect: left=282 top=220 right=254 bottom=354
  234. -- title width / last selected line: 0
  235. -- icon id / first selected line: 0 / 0
  236. -- text alignment: 1
  237. -- font id: 0
  238. -- text size: 12
  239. -- style flags: 0
  240. -- line height: 16
  241. -- part name: Date
  242.  
  243.  
  244. -- part 12 (button)
  245. -- low flags: 00
  246. -- high flags: 0000
  247. -- rect: left=15 top=164 right=188 bottom=38
  248. -- title width / last selected line: 0
  249. -- icon id / first selected line: 10610 / 10610
  250. -- text alignment: 1
  251. -- font id: 0
  252. -- text size: 12
  253. -- style flags: 0
  254. -- line height: 16
  255. -- part name: 
  256. ----- HyperTalk script -----
  257. on mouseUp
  258.   get the selection
  259.   if it is empty then get first word of field ID 2
  260.   if it is empty then ask "Dial what number?"
  261.   if it is not empty then
  262.     push this card
  263.     openSpeed
  264.     go to stack "Phone"
  265.     dial it
  266.     pop card
  267.     closeSpeed
  268.     hide msg
  269.   end if
  270. end mouseUp
  271.  
  272.  
  273.  
  274. -- part 15 (button)
  275. -- low flags: 00
  276. -- high flags: 0000
  277. -- rect: left=196 top=231 right=250 bottom=218
  278. -- title width / last selected line: 0
  279. -- icon id / first selected line: 11045 / 11045
  280. -- text alignment: 1
  281. -- font id: 0
  282. -- text size: 12
  283. -- style flags: 0
  284. -- line height: 16
  285. -- part name: Home
  286. ----- HyperTalk script -----
  287. on mouseUp
  288.   visual dissolve to gray
  289.   visual dissolve
  290.   go home
  291. end mouseUp
  292.  
  293.  
  294.  
  295. -- part 17 (field)
  296. -- low flags: 01
  297. -- high flags: 0000
  298. -- rect: left=245 top=222 right=252 bottom=286
  299. -- title width / last selected line: 0
  300. -- icon id / first selected line: 0 / 0
  301. -- text alignment: 0
  302. -- font id: 2
  303. -- text size: 24
  304. -- style flags: 0
  305. -- line height: 32
  306. -- part name: Page Number
  307. ----- HyperTalk script -----
  308. on mouseUp
  309.   openSpeed
  310.   repeat with x=1 to number of cards in this bg
  311.     set cursor to busy
  312.     go to card x of bg 1
  313.     if the mouseClick then exit repeat
  314.     put x into field ID 17
  315.   end repeat
  316.   closeSpeed
  317.   openCard
  318. end mouseUp
  319.  
  320.  
  321.  
  322. -- part 19 (button)
  323. -- low flags: 00
  324. -- high flags: A003
  325. -- rect: left=377 top=262 right=284 bottom=497
  326. -- title width / last selected line: 0
  327. -- icon id / first selected line: 0 / 0
  328. -- text alignment: 1
  329. -- font id: 0
  330. -- text size: 12
  331. -- style flags: 0
  332. -- line height: 16
  333. -- part name: New Card
  334. ----- HyperTalk script -----
  335. on mouseUp
  336.   if icon of bg btn id 31 is 28736 then
  337.     beep
  338.     put "Unlock input first!" into msg
  339.     exit  mouseUp
  340.   end if
  341.   doMenu new card
  342. end mouseUp
  343.  
  344.  
  345.  
  346. -- part 21 (button)
  347. -- low flags: 00
  348. -- high flags: 4000
  349. -- rect: left=382 top=220 right=249 bottom=486
  350. -- title width / last selected line: 0
  351. -- icon id / first selected line: 0 / 0
  352. -- text alignment: 1
  353. -- font id: 0
  354. -- text size: 12
  355. -- style flags: 0
  356. -- line height: 16
  357. -- part name: Delete note
  358. ----- HyperTalk script -----
  359. on mouseUp
  360.   show field ID 7
  361.   show bg button ID 23
  362.   if bg fld id 7 is empty then
  363.     select char 1 of fld id 7
  364.     exit mouseUp
  365.   end if
  366.   if optionKey() is down then
  367.     answer "Delete this note?" with "Yes" or "No"
  368.     if it is "Yes" then put empty into fld id 7
  369.     send mouseUp to bg btn id 23
  370.   end if
  371. end mouseUp
  372.  
  373.  
  374.  
  375. -- part 24 (field)
  376. -- low flags: 03
  377. -- high flags: 0000
  378. -- rect: left=72 top=266 right=283 bottom=143
  379. -- title width / last selected line: 0
  380. -- icon id / first selected line: 0 / 0
  381. -- text alignment: 0
  382. -- font id: 0
  383. -- text size: 12
  384. -- style flags: 0
  385. -- line height: 16
  386. -- part name: Birthday*
  387. ----- HyperTalk script -----
  388. on closeField
  389.   if me is empty then
  390.     put empty into bg field id 11
  391.     pass returnInField
  392.   end if
  393.   if char 2 of me is "/" then put "0" before me
  394.   if char 5 of me is "/" then put "0" after char 3 of me
  395.   if (length  of me) = 4 then
  396.     put "0" before me
  397.     put "0" before char 3 of me
  398.   end if
  399.   if (length of me) = 5 then put "0" before me
  400.   if (length of me) = 6 then
  401.     put line 1 of me into temp
  402.     put (char 1 to 2 of temp) & "/" & (char 3 to 4 of temp) & "/" & (char 5 to 6 of temp) into me
  403.   end if
  404.   if check() then
  405.     select line 1 of me
  406.     exit closeField
  407.   end if
  408.   send mouseUp to bg fld id 11
  409.   pass closeField
  410. end closeField
  411.  
  412. on mouseUp
  413.   put checkBirth(me) into msg
  414. end mouseUp
  415.  
  416.  
  417.  
  418. -- part 26 (button)
  419. -- low flags: 00
  420. -- high flags: A003
  421. -- rect: left=377 top=288 right=310 bottom=497
  422. -- title width / last selected line: 0
  423. -- icon id / first selected line: 0 / 0
  424. -- text alignment: 1
  425. -- font id: 0
  426. -- text size: 12
  427. -- style flags: 0
  428. -- line height: 16
  429. -- part name: Delete card
  430. ----- HyperTalk script -----
  431. on mouseUp
  432.   answer "Kill this card?" with "Yes" or "No"
  433.   if it is "Yes" then
  434.     doMenu delete card
  435.   end if
  436. end mouseUp
  437.  
  438.  
  439.  
  440. -- part 29 (button)
  441. -- low flags: 00
  442. -- high flags: 0000
  443. -- rect: left=137 top=225 right=253 bottom=170
  444. -- title width / last selected line: 0
  445. -- icon id / first selected line: 8538 / 8538
  446. -- text alignment: 1
  447. -- font id: 0
  448. -- text size: 12
  449. -- style flags: 0
  450. -- line height: 16
  451. -- part name: Find help
  452. ----- HyperTalk script -----
  453. on mouseUp
  454.   doMenu find...
  455. end mouseUp
  456.  
  457.  
  458.  
  459. -- part 28 (button)
  460. -- low flags: 00
  461. -- high flags: 2000
  462. -- rect: left=10 top=283 right=309 bottom=38
  463. -- title width / last selected line: 0
  464. -- icon id / first selected line: 1009 / 1009
  465. -- text alignment: 1
  466. -- font id: 0
  467. -- text size: 12
  468. -- style flags: 0
  469. -- line height: 16
  470. -- part name: Check birth day
  471. ----- HyperTalk script -----
  472. on mouseUp
  473.   openSpeed
  474.   put the date into today
  475.   put the number of cards in bg 1 into y
  476.   if char 2 of today is "/" then put "0" before today
  477.   repeat with x = 1 to y
  478.     percent x,y
  479.     go card x in bg 1
  480.     if the mouseClick then exit repeat
  481.     if field ID 24 is empty then
  482.       put empty into field ID 11
  483.       next repeat
  484.     else
  485.       put field ID 24 into bday
  486.       if the number of chars in bday Γëá 8 then
  487.         beep
  488.         next repeat
  489.       end if
  490.       if checkBirth(bday) < 7 then
  491.         send mouseUp to bg fld id 11
  492.         beep
  493.         answer word 1 of bg field id 18 & "'s birthday is near!!!" with "Continue" or "Stop"
  494.         if it is "Stop" then
  495.           closeSpeed
  496.           hide msg
  497.           exit mouseUp
  498.         end if
  499.       end if
  500.     end if
  501.   end repeat
  502.   closeSpeed
  503.   hide msg
  504.   go first Card in bg 1
  505. end mouseUp
  506.  
  507.  
  508.  
  509. -- part 32 (button)
  510. -- low flags: 00
  511. -- high flags: A003
  512. -- rect: left=377 top=314 right=336 bottom=497
  513. -- title width / last selected line: 0
  514. -- icon id / first selected line: 0 / 0
  515. -- text alignment: 1
  516. -- font id: 0
  517. -- text size: 12
  518. -- style flags: 0
  519. -- line height: 16
  520. -- part name: Sort Cards
  521. ----- HyperTalk script -----
  522. on mouseUp
  523.   openSpeed
  524.   answer "Sort cards by what?" with "First Name" or "Last Name" or "Cancel"
  525.   if it is "Cancel" then exit mouseUp
  526.   if it is "Birthday" then sort by bg field id 24
  527.   if it is "First Name" then sort by word 1 of bg field id 18
  528.   if it is "Last Name" then sort by last word of bg field id 18
  529.   go bg 1
  530.   send mouseUp to bg field id 17
  531.   go card 1 in bg 1
  532.   closeSpeed
  533. end mouseUp
  534.  
  535.  
  536.  
  537. -- part 33 (button)
  538. -- low flags: 00
  539. -- high flags: 0000
  540. -- rect: left=101 top=224 right=254 bottom=138
  541. -- title width / last selected line: 0
  542. -- icon id / first selected line: 11645 / 11645
  543. -- text alignment: 1
  544. -- font id: 0
  545. -- text size: 12
  546. -- style flags: 0
  547. -- line height: 16
  548. -- part name: Go index
  549. ----- HyperTalk script -----
  550. on mouseUp
  551.   go bg 2
  552. end mouseUp
  553.  
  554.  
  555.  
  556. -- part 31 (button)
  557. -- low flags: 00
  558. -- high flags: 2000
  559. -- rect: left=315 top=27 right=63 bottom=350
  560. -- title width / last selected line: 0
  561. -- icon id / first selected line: 28736 / 28736
  562. -- text alignment: 1
  563. -- font id: 0
  564. -- text size: 12
  565. -- style flags: 0
  566. -- line height: 16
  567. -- part name: Level change
  568. ----- HyperTalk script -----
  569. on mouseUp
  570.   get the icon of me
  571.   if it is 28736 then
  572.     unLot false
  573.     set textArrows to true
  574.     set icon of me to 13430
  575.     play Floop
  576.   else
  577.     unLot true
  578.     set textArrows to false
  579.     play bluup
  580.     set icon of me to 28736
  581.   end if
  582. end mouseUp
  583.  
  584. on unLot test
  585.   set lockText of fld id 18 to test
  586.   set lockText of fld id 1 to test
  587.   set lockText of fld id 24 to test
  588.   set lockText of fld id 2 to test
  589. end unLot
  590.  
  591.  
  592. -- part 7 (field)
  593. -- low flags: 80
  594. -- high flags: 6001
  595. -- rect: left=5 top=24 right=338 bottom=504
  596. -- title width / last selected line: 0
  597. -- icon id / first selected line: 0 / 0
  598. -- text alignment: 0
  599. -- font id: 2
  600. -- text size: 14
  601. -- style flags: 0
  602. -- line height: 18
  603. -- part name: Notes
  604. ----- HyperTalk script -----
  605. on closeField
  606.   hide me
  607.   hide bg button ID 23
  608.   openCard
  609. end closeField
  610.  
  611.  
  612.  
  613. -- part 23 (button)
  614. -- low flags: 80
  615. -- high flags: 0001
  616. -- rect: left=473 top=310 right=336 bottom=503
  617. -- title width / last selected line: 0
  618. -- icon id / first selected line: 19678 / 19678
  619. -- text alignment: 1
  620. -- font id: 0
  621. -- text size: 12
  622. -- style flags: 0
  623. -- line height: 16
  624. -- part name: Quit note
  625. ----- HyperTalk script -----
  626. on mouseUp
  627.   hide field ID 7
  628.   hide me
  629.   openCard
  630. end mouseUp
  631.  
  632.